package com.ktjiaoyu.ktmall.service.impl;

import com.ktjiaoyu.ktmall.dao.ProductDao;
import com.ktjiaoyu.ktmall.dao.impl.ProductDaoImpl;
import com.ktjiaoyu.ktmall.entity.Product;
import com.ktjiaoyu.ktmall.service.ProductService;

import java.util.List;

public class ProductServiceImpl implements ProductService {
    private final ProductDao productDao=new ProductDaoImpl();
    @Override
    public List<Product> findList(String title, Long categoryId, int page, int pageSize) {
        return productDao.findList(title, categoryId, page, pageSize);
    }

    @Override
    public int count(String title, Long categoryId) {
        return productDao.count(title,categoryId);
    }

    @Override
    public Product findById(Long id) {
        return productDao.findById(id);
    }

    @Override
    public int insert(Product product) {
        return productDao.insert(product);
    }

    @Override
    public int update(Product product) {
        return productDao.update(product);
    }

    @Override
    public boolean removeById(Long id) {
        return productDao.delete(id)>0;
    }

    @Override
    public boolean updateStatus(Long id, Integer status) {
        return productDao.updateStatus(id,status)>0;
    }


}
